//
//  YanzhengViewController.m
//  盘盈贷1.2
//
//  Created by iOS on 15/3/16.
//  Copyright (c) 2015年 iOS. All rights reserved.
//

#import "YanzhengViewController.h"
#import "AFHTTPRequestOperationManager.h"
@interface YanzhengViewController ()
{
    UITextField *mess;
}
@end

@implementation YanzhengViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
        self.title = @"找回登陆密码";
        self.view.backgroundColor = [UIColor whiteColor];
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"tele :%@", self.telephone);
    CGFloat width = self.view.frame.size.width;
    CGFloat height = self.view.frame.size.height;
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(width / 3.1, height / 4.9, 100, 30)];
    label.center = CGPointMake(width / 3.1, height / 4.9);
    //label.backgroundColor = [UIColor redColor];
    label.text = @"您的手机号 :";
    label.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:label];
    [label release];
    UILabel *num = [[UILabel alloc] initWithFrame:CGRectMake(width / 1.75, height / 4.9, 100, 30)];
    num.center = CGPointMake(width / 1.75, height / 4.9);
    num.text = self.telephone;
    //num.backgroundColor = [UIColor yellowColor];
    num.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:num];
    [num release];
    
    mess = [[UITextField alloc] initWithFrame:CGRectMake(width / 3.1, height / 3.6, 150, 40)];
    mess.center = CGPointMake(width / 3.1, height / 3.6);
    //label.backgroundColor = [UIColor redColor];
    mess.placeholder = @"短信验证码";
    mess.borderStyle = UITextBorderStyleRoundedRect;
    
    mess.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:mess];
    [mess release];
    UIButton *test = [UIButton buttonWithType:UIButtonTypeSystem];
    test.frame = CGRectMake(width / 1.3, height / 3.6, width / 4, 40);
    test.center = CGPointMake(width / 1.35, height / 3.6);
    [test setTitle:@"获取验证码" forState:UIControlStateNormal];
    test.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
    test.backgroundColor = [UIColor redColor];
    [test setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [test addTarget:self action:@selector(test:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:test];
    
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(width / 1.79, height / 2.05, width / 1.1, 40)];
    label1.center = CGPointMake(width / 1.79, height / 2.05);
    label1.text = @"若您无法使用上述方法找回,请联系客服400-055-9997";
    label1.numberOfLines = 0;
    label1.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:label1];
    [label1 release];
    
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(10, height / 2.5, width / 1.4, 40);
    button.center = CGPointMake(width / 1.99, height / 2.5);
    [button setTitle:@"下一步" forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
    button.backgroundColor = [UIColor redColor];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(finish:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
}

- (void)test:(id)sender
{
    
    
    NSString *str = @"http://www.cloudpeng.com:8102/account/SendRegisterPhone?phone=18516276195&tpl_id=7";
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    [manager GET:str parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSString *ss = [[responseObject firstObject] objectForKey:@"value"];
        mess.text = ss;
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"~~~~~~~%@",error);
    }];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
